package com.cmxh.shipper.controller;

import com.cmxh.shipper.pojo.Supplier;
import com.cmxh.shipper.service.SupplierService;
import com.cmxh.shipper.util.Code;
import com.cmxh.shipper.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SupplierController {
    @Autowired
    private SupplierService supplierService;

    //查询供应商
    @RequestMapping("/chaxungongyingshang")
    public Result chaxungongyingshang() {
        System.out.println("查询供应商");
        List<Supplier> chaxungongyingshang = supplierService.chaxungongyingshang();
        if (chaxungongyingshang != null && chaxungongyingshang.size() > 0) {
            return new Result(Code.GET_OK, chaxungongyingshang, "查询成功");
        } else {
            return new Result(Code.GET_ERR, "查询失败");
        }
    }
}
